package class202205.demo05.demo02;


class Shape{
    //省略了属性
    public void draw(){
        System.out.println("画图形！");
    }
}
class Circle extends Shape{
    @Override
    public void draw() {
        System.out.println("⭕");
    }
}
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("♦");
    }
}
class Triangle extends Shape{
    @Override
    public void draw() {
        System.out.println("🔺");
    }
}
class Flower extends Shape{
    @Override
    public void draw() {
        System.out.println("❀");
    }
}
public class TestDemo {

    public static void drawMap(Shape shape){
        shape.draw();
    }

    public static void main(String[] args) {
        Circle circle = new Circle();
        Rect rect = new Rect();
        Triangle triangle = new Triangle();
        Shape[] shapes = {circle,rect,circle,rect,new Flower()};
        for (Shape shap:shapes) {
            shap.draw();
        }
       /* drawMap(circle);
        drawMap(rect);
        drawMap(triangle);
        drawMap(new Flower());*/
    }

    public static void main1(String[] args) {
        Shape shape = new Circle();
        shape.draw();
    }
}
